import { SetMetadata, createParamDecorator, Query } from '@nestjs/common';
import { filterNon0FalseValue } from '@/utils';

// 自定义装饰器
export const MyCustomDecorator = (data: string) =>
  SetMetadata('myCustomDecorator', data);

/**
 * 过滤假值非0装饰器
 */
export const Non0Params = createParamDecorator((data: string, ctx) => {
  
  const query = ctx.switchToHttp().getRequest().query
  return filterNon0FalseValue(query)
});
